import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TDirectionCopy } from "../../../Message/Db/Tables/TDirectionCopy";
type int = number;
//class DirectionCopyConfig
    
    export  class DirectionCopyConfig
    {
        constructor()
        {
            
            this._dic = new Map<any, any> /* flash.utils.Dictionary */();
            if (DirectionCopyConfig._instance != null) 
            {
                new Error("DirectionDropConfig单例不能new");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_direction_copy.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                if (loc2 == null) 
                {
                    continue;
                }
                loc1 = new TDirectionCopy();
                loc1.copyCode = loc2.copyCode;
                loc1.floor = loc2.floor;
                loc1.requireCombat = loc2.requireCombat;
                loc1.nextCode = loc2.nextCode;
                loc1.describe = loc2.describe;
                this._dic[loc1.floor] = loc1;
            }
            return;
        }

        public getItemByFloor(arg1: int): TDirectionCopy
        {
            return this._dic[arg1] as TDirectionCopy;
        }

        public getNextCopyRequireCombat(arg1: int): int
        {
            var loc1=0;
            var loc2=this.getItemByFloor(arg1);
            if (loc2) 
            {
                loc1 = loc2.requireCombat;
            }
            else 
            {
                loc1 = int.MAX_VALUE;
            }
            return loc1;
        }

        public static get instance(): DirectionCopyConfig
        {
            if (DirectionCopyConfig._instance == null) 
            {
                DirectionCopyConfig._instance = new DirectionCopyConfig();
            }
            return DirectionCopyConfig._instance;
        }

        /* internal */ /* var */_dic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: DirectionCopyConfig;
    }
